'use strict';

const Util = require('./Util');

class RedisUtil {

    static set(app, key, value, lifeTime) {
        if (Util.empty(lifeTime) || lifeTime === 0) {
            app.redis.set(key, value);
            return;
        }
        app.redis.set(key, value, 'EX', lifeTime);
    }


    static get(app, key) {
        return app.redis.get(key);
    }

}

module.exports = RedisUtil;